package com.example.demo2;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.GridView;
import android.widget.SimpleAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class jrMainActivity extends AppCompatActivity {
private int[] pp = new int[]{R.drawable.img01,R.drawable.img02,R.drawable.img03,R.drawable.img04,
        R.drawable.img05,R.drawable.img06,R.drawable.img07,R.drawable.img08,R.drawable.img09};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jr_main);

        GridView gridView = (GridView)findViewById(R.id.gridview);
        ArrayList<Map<String,Object>> list = new ArrayList<Map<String, Object>>();

        for(int i=0;i<pp.length;i++){
            Map<String,Object> map = new HashMap<String, Object>();
            map.put("image",pp[i]);
            list.add(map);

        }
        SimpleAdapter simpleAdapter = new SimpleAdapter(this,list,R.layout.celll,new String[]{"image"},new int[]{R.id.iamge});
        gridView.setAdapter(simpleAdapter);
    }
}
